package com.fh.collection;


import java.util.ArrayList;
import java.util.Collection;

public class collectionFor {
    @SuppressWarnings({"all"})
    public static void main(String[] args) {
        //Collection接口遍历对象的方式2-增强for循环
        Collection col = new ArrayList();
        col.add(new Book("三国演义","罗贯中",30.5));
        col.add(new Book("小李飞刀","古龙",30.1));
        col.add(new Book("红楼梦","曹雪芹",30.6));
        //增强for循环，底层依旧是迭代器，可以理解成简化版的迭代器遍历。快捷键 I
        //可以通过debug的方式来查看
        for (Object book : col) {
            System.out.println(book);
        }

    }
}
